package com.foreverwin.jzymes.report.crop.controller;

import com.foreverwin.jzymes.common.util.CommonMethods;
import com.foreverwin.jzymes.framework.base.AjaxResult;
import com.foreverwin.jzymes.framework.exception.BusinessException;
import com.foreverwin.jzymes.production.fqc.domain.FqcCheck;
import com.foreverwin.jzymes.report.crop.service.ICropMobilityReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/report/crop")
public class CropMobilityReportController {
    @Autowired
    ICropMobilityReportService cropMobilityReportService;


    @RequestMapping("/cropMobilityReport")
    public AjaxResult cropMobilityReport(@RequestParam Map<String , Object> jsonMap){
        try{
            jsonMap.put("site",CommonMethods.getSite());
            Map< String,Object > list = null;
            try {
                list = cropMobilityReportService.findCropMobilityByReport( jsonMap );
            } catch (ParseException e) {
                e.printStackTrace();
            }
            return AjaxResult.returnSuccess().put("value",list);
        }catch ( BusinessException e ){
            return AjaxResult.returnError( e.getMessage() );
        }
    }


}
